//
//  MyheaderView.m
//  ZHIDOU
//
//  Created by 向礼 on 2018/12/24.
//  Copyright © 2018 向礼. All rights reserved.
//

#import "MyheaderView.h"
@interface MyheaderView()
@property (weak, nonatomic) IBOutlet UIButton *DownLoadBtn;
@property (weak, nonatomic) IBOutlet UIButton *MyClassBtn;
@property (weak, nonatomic) IBOutlet UIView *touchuView;

@end

@implementation MyheaderView
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self = [[NSBundle mainBundle] loadNibNamed:@"MyheaderView" owner:self options:nil].firstObject;
        self.frame = frame;
        self.autoresizingMask = NO; // 否则会根据父视图大小变化
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    _MyClassBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 40);
    _MyClassBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 130, 0, 0);
    _DownLoadBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 40);
    _DownLoadBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 130, 0, 0);
    _touchuView.userInteractionEnabled = YES;
    //添加手势
    
    UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(event:)];
    //将手势添加到需要相应的view中去
    
    [_touchuView addGestureRecognizer:tapGesture];

    [tapGesture setNumberOfTapsRequired:1];
    
}
- (IBAction)PushMyClass:(id)sender {
    if (_btnBlock) {
        _btnBlock(ClassVC);
    }
}
- (IBAction)DownLoad:(id)sender {
    if (_btnBlock) {
        _btnBlock(DownloadVC);
    }
}

- (void)event:(UITapGestureRecognizer *)tap{
    if (_btnBlock) {
        _btnBlock(MyCenterVC);
    }
}

@end
